package mlpEnsemble;

import java.util.List;

import utils.RandomGenerator;

import genetic_algorithm.Chromosome;
import genetic_algorithm.Mutation;

public class MlpEnsembleMutation implements Mutation{

	int mlpListSize;
	
	
	
	public MlpEnsembleMutation(int mlpListSize) {
		this.mlpListSize = mlpListSize;
	}



	@Override
	public void mutate(List<Chromosome> chromosomes, double rate) {
		for(Chromosome c :chromosomes)
		{
			if(RandomGenerator.nextDouble() < rate)
			{
				int[] mlps = new int[10];
				for(int j= 0 ; j < 10 ; j++)
				{
					mlps[j] = RandomGenerator.nextInt(mlpListSize);
				}
				int index = RandomGenerator.nextInt(c.getAllValues().size());
				c.setValue(index, mlps);
			}
		}
		
	}

}
